<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>

<div class="layui-fluid" id="app" style="margin-top: 0px">

    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">

            <div class="layui-card">

                <div class="layui-card-body">
                    <form class="layui-form" action="" lay-filter="component-form-group">

                        <div class="layui-card-body" style="padding: 15px;">

                            <input type="hidden" name="id" value="{$item.id}">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">店铺</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" id="selected_dp" readonly="readonly"
                                               value="{$item.shangjia.shop_name}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">状态</label>
                                    <div class="layui-input-inline">
                                        <input v-if="status=='1'" type="text" name="status" value="上架"
                                               class="layui-input" readonly="readonly">
                                        <input v-if="status=='0'" type="text" name="status" value="下架"
                                               class="layui-input" readonly="readonly">
                                    </div>
                                </div>


                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="name" value="{$item.name}" class="layui-input"
                                               readonly="readonly">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">分类</label>
                                    <div class="layui-input-inline">
                                        <select name="fenlei" id="fenlei">
                                            <option value="开关" disabled>开关</option>
                                            <option value="门" disabled>门</option>
                                            <option value="地板" disabled>地板</option>
                                            <option value="窗帘" disabled>窗帘</option>
                                            <option value="油漆" disabled>油漆</option>
                                            <option value="锁" disabled>锁</option>
                                            <option value="插座" disabled>插座</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label">型号</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="xinghao" value="{$item.xinghao}" class="layui-input"
                                               readonly="readonly">
                                    </div>
                                </div>


                                <div class="layui-inline">
                                    <label class="layui-form-label">材质</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="caizhi" value="{$item.caizhi}" class="layui-input"
                                               readonly="readonly">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">位置</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="functional" title="客厅" lay-skin="primary" value="客厅"
                                           disabled>
                                    <input type="checkbox" name="functional" title="厨房" lay-skin="primary" value="厨房"
                                           disabled>
                                    <input type="checkbox" name="functional" title="卧室" lay-skin="primary" value="卧室"
                                           disabled>
                                    <input type="checkbox" name="functional" title="洗漱台" lay-skin="primary" value="洗漱台"
                                           disabled>
                                    <input type="checkbox" name="functional" title="阳台" lay-skin="primary" value="阳台"
                                           disabled>
                                    <input type="checkbox" name="functional" title="浴室" lay-skin="primary" value="浴室"
                                           disabled>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">品牌</label>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" id="selected" readonly="readonly"
                                                   value="{$item.pinpai.pinpai}">
                                        </div>
                                    </div>

                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">价格</label>
                                    <div class="layui-input-inline" >
                                        <input type="text" name="price" value="{$item.price}"  class="layui-input"  readonly="readonly" >
                                    </div>
                                    <div class="layui-form-mid">元</div>

                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">优惠</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="discount" value="{$item.discount}" class="layui-input"
                                               readonly="readonly">
                                    </div>
                                    <div class="layui-form-mid">折</div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">图片</label>

                                <div class="layui-input-inline " style="width: auto;">

                                    <div class="layui-upload-drag" style="padding: 2px">
                                        <img v-if="list=='null'" class="layui-upload-img"
                                             style="width: 120px;height: 120px; object-fit: cover;"
                                             src="/res/img/thumb.png">
                                        <img v-else class="layui-upload-img"
                                             style="width: 120px;height: 120px; object-fit: cover;"
                                             src="{$item.thumb2}">
                                    </div>

                                </div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">简介</label>
                                <div class="layui-input-block">
                                    <textarea name="remarks" placeholder="请输入内容" class="layui-textarea"
                                              readonly="readonly">{$item.remarks}</textarea>
                                </div>
                            </div>
                            <!--<div class="layui-form-item">-->
                            <!--<label class="layui-form-label">状态</label>-->
                            <!--<div class="layui-input-block">-->
                            <!--<input v-if="status=='1'" type="text" name="caizhi" value="上架"  class="layui-input" readonly="readonly">-->
                            <!--<input v-if="status=='0'" type="text" name="caizhi" value="下架"  class="layui-input" readonly="readonly">-->
                            <!--</div>-->
                            <!--</div>-->

                        </div>

                    </form>
                </div>


            </div>
        </div>
    </div>


</div>
</body>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            list: "",
            status: ""
        },

    });
    app.list = "{$item.thumb2}";//图片路径
    app.status = "{$item.status}";//状态值
    layui.use(['form', 'laydate', 'upload'], function () {
        var $ = layui.$
            , element = layui.element
            , layer = layui.layer
            , laydate = layui.laydate
            , form = layui.form;
        var upload = layui.upload;

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });


    });

    //设获取分类状选中的值
    function setSelect(ele, val) {

        $('#' + ele + ' option').each(function (index, ele) {
            var el = $(ele);
            if (el.attr('value') == val) {
                el.attr('selected', 'selected')
            } else {
                el.removeAttr('selected');
            }
        })

    }

    $(function () {
        setSelect('fenlei', "{$item.fenlei}")
    });
    //获取复选框选中的值
    var re = "{$item.weizhi}";
    var check = re.split(",");
    var groupCheckbox = $("input[name='functional']");
    $(function () {
        for (var i = 0; i < groupCheckbox.length; i++) {
            var val = groupCheckbox[i].value;
            if (check.indexOf(val) != -1) {
                groupCheckbox[i].checked = true;
            }
        }
    });
</script>

</html>










